package org.healer.simple_juc;

import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class TestExecutorService {
    public static void main(String[] args) {
        ExecutorService es = Executors.newFixedThreadPool(10);

        es.execute(new TestExecutorService1());
        es.execute(new TestExecutorService1());
        es.execute(new TestExecutorService1());
        es.execute(new TestExecutorService1());

        es.shutdown();
    }

}
class TestExecutorService1 implements Runnable{

    @Override
    public void run() {
        try {
            Thread.sleep(300);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        for (int i = 0; i < 5; i++) {
            System.out.println(Thread.currentThread().getName() + "---->"+i);

        }
    }
    }